package com.zhejiangzhengyuan.municipal_common.utils;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author :linju
 * @create on : 2019/11/25
 */
//Spring boot方式
@EnableTransactionManagement
@Configuration
@MapperScan("com.zhejiangzhengyuan.municipal_common.mapper")
public class MybatisPlusConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setDialectType("postgresql");
        return paginationInterceptor;
    }
    //BCrypt加密依赖注入
    @Bean
    public BCryptPasswordEncoder encoder(){
        return new BCryptPasswordEncoder(10);
    }
    @Bean
    public IdWorker idWorker(){
        return new IdWorker(1,1);
    }


}
